/*
Coder: Dzlua
Email: 505544956@qq.com
Time : 2017/05/18
*/
#pragma once

#include <string>
#include <WinSock2.h>

class CmdTask;

class Service
{
public:
    Service();
    ~Service();

    bool Init(unsigned short port);

    void Send(SOCKADDR_IN &addrClient, int addr_len, const std::string& data);

    void Listen();
protected:
    SOCKET m_sock;
};

class Client
{
public:
    Client();
    ~Client();

    bool Init(const std::string& ip, unsigned short port);
    void Send(const std::string& data);
    void Send(CmdTask* task);
    std::string Receive();
protected:
    SOCKET m_sock;
    SOCKADDR_IN m_addr;
};